package com.longcai.piaojia.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/9/23.
 */
@HttpInlet(Conn.ORDER_INTEGRAL)
public class OrderIntegralGet extends BaseAsyGet<OrderIntegralGet.OrderIntegralEntity> {

    public String user_id;

    public OrderIntegralGet(AsyCallBack<OrderIntegralGet.OrderIntegralEntity> asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected OrderIntegralEntity parser(JSONObject object) throws Exception {


        TOAST = object.optString("message");

        if (object.optInt("code") == 200) {

            JSONObject dataObject = object.optJSONObject("data");

            OrderIntegralEntity orderIntegralEntity = new OrderIntegralEntity();

            orderIntegralEntity.integral = dataObject.optString("integral");
            orderIntegralEntity.deduction = dataObject.optString("deduction");
            orderIntegralEntity.proportion = dataObject.optString("proportion");

            return orderIntegralEntity;
        }

        return null;
    }

    public static class OrderIntegralEntity {

        public String integral, deduction, proportion;

    }

}
